<?php
$times = isset($_REQUEST['times'])?$_REQUEST['times']:0;
$url = 'https://download.fir.im/apps/58141669ca87a8391100086b/install?download_token=f64caa2e8ea8680b70da9a89ef421a81&release_id=58141707ca87a83911000879';
function down($url,$times){
    echo 'start<br/>';
    $token_url = $url;
    $ch = curl_init ();
    curl_setopt ( $ch, CURLOPT_URL,$token_url );
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); 
    curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false ); 
    curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false );
    $strData = curl_exec ( $ch );
    curl_close ( $ch );
    $data2 = json_decode( $strData, true );
    echo "end<br/>";
    echo "execute times : ".$times."<br/>";
    echo "after 10 seconds be continue<br/>";
}
down($url,$times);
?>
<script>
	var times = '<?php echo ($times+1);?>';
	setTimeout(function(){
		window.location.href = 'url.php?times='+times;
	},5000);
</script>